
class teticket_result{
    constructor() {
        
    }
    
		initView () {

			this.initLineInfo();
			this.initPayWays();
			this.counDownTime();

		}
   initLineInfo () {

			$("#span-min").html("20");
			$("#span-sec").html("08");
			$("#span-paymoany").html("70");
			$("#eticket-payorder-info-month").html("4月27日");
			$("#eticket-payorder-info-week").html("周一");
			$("#eticket-payorder-info-hour").html("14:00");
			$("#eticket-payorder-info-start").html("长春上地园区");
			$("#eticket-payorder-info-end").html("长春机场");
		}
		initPayWays () {
			var payways = [{
				"wayicon": "wxpay",
				"wayname": "微信"
			}];
			var payHtml = "";
			$.each(payways, function (i, o) {


				payHtml += '<li onclick="teticket_result.changeSelect()"><img src="images/{0}.png" class="eticket-payorder-info-ways-icon" /><span class="eticket-payorder-info-ways-des">{1}</span><img src="images/noselect.png" data-check="0" class="eticket-payorder-info-ways-check">'.format(o.wayicon, o.wayname);

			});
			$(".eticket-payorder-info-ways").html(payHtml);

		}
		counDownTime () {
			var paylefttime = 1000;
			countDown((new Date()).getTime(), paylefttime, function (val:number) {
				let hour = Math.floor(val / 3600);;
				let minute = Math.floor((val - hour * 3600) / 60);
				let second = Math.floor(val - hour * 3600 - minute * 60);
				let shour = hour < 10 ? ("0" + hour) : hour;
				let sminute = minute < 10 ? ("0" + minute) : minute;
				let ssecond = second < 10 ? ("0" + second) : second;
				$("#span-min").text(sminute);
				$("#span-sec").text(ssecond);
			}, function () {
				$("#span-min").text('00');
				$("#span-sec").text('00');

			})

		}
		changeSelect (event) {

			var e = event || window.event;
			var target = e.target;
			if (target.tagName.toLowerCase() == 'li') {
				target = target.lastElementChild;


			}
			var datacheck = $(target).attr("data-check");
			if (datacheck == "0") {

				$(target).attr("src", "images/noselect.png");
				$(target).attr("data-check", "1");
			}
			else {
				$(target).attr("src", "images/select.png");
				$(target).attr("data-check", "0");
			}

		}

	

}

$(function () {
    var obj = new teticket_result();
    window.teticket_result = obj;
    obj.initView();
    
});
